/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.ac.c0910g.assignment.Entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author BachLe
 */
@Entity
@Table(name = "PaymentDetails")
@NamedQueries({
    @NamedQuery(name = "PaymentDetails.findAll", query = "SELECT p FROM PaymentDetails p"),
    @NamedQuery(name = "PaymentDetails.findByPaymentDetailsID", query = "SELECT p FROM PaymentDetails p WHERE p.paymentDetailsID = :paymentDetailsID"),
    @NamedQuery(name = "PaymentDetails.findByPaidAmount", query = "SELECT p FROM PaymentDetails p WHERE p.paidAmount = :paidAmount"),
    @NamedQuery(name = "PaymentDetails.findByDatePaid", query = "SELECT p FROM PaymentDetails p WHERE p.datePaid = :datePaid")})
public class PaymentDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PaymentDetailsID")
    private Integer paymentDetailsID;
    @Basic(optional = false)
    @Column(name = "PaidAmount")
    private Integer paidAmount;
    @Basic(optional = false)
    @Column(name = "DatePaid")
    @Temporal(TemporalType.TIMESTAMP)
    private Date datePaid;
    @JoinColumn(name = "PaymentID", referencedColumnName = "PaymentID")
    @ManyToOne(optional = false)
    private Payment payment;

    public PaymentDetails() {
    }

    public PaymentDetails(Integer paymentDetailsID) {
        this.paymentDetailsID = paymentDetailsID;
    }

    public PaymentDetails(Integer paymentDetailsID, Integer paidAmount, Date datePaid) {
        this.paymentDetailsID = paymentDetailsID;
        this.paidAmount = paidAmount;
        this.datePaid = datePaid;
    }

    public Integer getPaymentDetailsID() {
        return paymentDetailsID;
    }

    public void setPaymentDetailsID(Integer paymentDetailsID) {
        this.paymentDetailsID = paymentDetailsID;
    }

    public Integer getPaidAmount() {
        return paidAmount;
    }

    public void setPaidAmount(Integer paidAmount) {
        this.paidAmount = paidAmount;
    }

    public Date getDatePaid() {
        return datePaid;
    }

    public void setDatePaid(Date datePaid) {
        this.datePaid = datePaid;
    }

    public Payment getPayment() {
        return payment;
    }

    public void setPayment(Payment payment) {
        this.payment = payment;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paymentDetailsID != null ? paymentDetailsID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaymentDetails)) {
            return false;
        }
        PaymentDetails other = (PaymentDetails) object;
        if ((this.paymentDetailsID == null && other.paymentDetailsID != null) || (this.paymentDetailsID != null && !this.paymentDetailsID.equals(other.paymentDetailsID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vn.ac.c0910g.assignment.DAO.PaymentDetails[paymentDetailsID=" + paymentDetailsID + "]";
    }

}
